{% extends "BackendBundle::backend.html.twig" %}

{% block title "Administración de Hoteles" %}

{% if alta == 1 %}

    {% set Title = "Alta hotel" %}
    {% set nom = "" %}
    {% set web = "" %}
    {% set mail = "" %}
    {% set tel = "" %}

{% else %}

    {% set Title = "Modificación Hotel" %}
    {% set nom = hotel.hotelname %}
    {% set web = hotel.hotelweb %}
    {% set mail = hotel.hotelmail %}
    {% set tel = hotel.hoteltel %}

{% endif %}

{% block js %}

   {% javascripts
        '@HotelBundle/Resources/public/js/jquery.validate.js'
        '@HotelBundle/Resources/public/js/Hotel.js'
   %}
        <script src="{{ asset_url }}"></script>
   {% endjavascripts %}

{% endblock %}
        
{% set vars = {'ruta' : app.request.attributes.get('_route'), 'configuracio' : configuracio, 'hotelspublicats' : hotelspublicats } %}

{% block header %}
        
    {% include "BackendBundle::topmenu.html.twig" with vars %}
        
{% endblock %}

{% block left %}

    {% if alta != 1 %}
        
        {% include "HotelBundle:Hotel:menuleft.html.twig" with vars %}
        
    {% endif %}    
        
{% endblock %}

{% block content %}
    
    {% if alta != 1 %}
    <div class="span9">    
    {% else %}
    <div class="span12">
    {% endif %}
        
        <form action="{{ path('HotelBundle_save') }}" class="form-horizontal" name="formhotel" id="formhotel" method="post">
            <fieldset>
                <legend>{{ Title }}</legend>
                
                {% if app.session.hasFlash('success') %}
                    <div class="flash-notice alert alert-success">
                        <h4 class="alert-heading">Ok!</h4>                     
                        {{ app.session.flash('success') }}
                    </div>
                {% endif %}
                
                {% if app.session.hasFlash('error') %}
                    <div class="flash-notice alert alert-error">
                        <h4 class="alert-heading">Error!</h4>                        
                        {{ app.session.flash('error') }}
                    </div>
                {% endif %}
                    
                {% if app.session.hasFlash('info') %}
                    <div class="flash-notice alert alert-info">
                        <h4 class="alert-heading">Info!</h4>
                        <p>{{ app.session.flash('info') }}</p>
                    </div>
                {% endif %}
                
                <div class="control-group">
                    
                    <label class="control-label" for="hotelnom">{{ "Nom del Hotel"|trans }} *</label>
                    
                    <div class="controls">
                        <input type="text" class="input-xlarge" name="hotelnom" id="hotelnom" value="{{nom}}" />
                    </div>
                    
                </div>
                
                <div class="control-group">
                    
                    <label class="control-label" for="hotelweb">{{ "Web del Hotel"|trans }} *</label>
                    
                    <div class="controls">
                        <input type="text" class="input-xlarge" name="hotelweb" id="hotelweb" value="{{web}}" />
                    </div>
                    
                </div>
                
                <div class="control-group">
                    
                    <label class="control-label" for="hotelmail">{{ "Email del Hotel"|trans }} *</label>
                    
                    <div class="controls">
                        <input type="text" class="input-xlarge" name="hotelmail" id="hotelmail" value="{{mail}}" />
                    </div>
                    
                </div>
                
                <div class="control-group">
                    
                    <label class="control-label" for="hoteltel">{{ "Tel. del Hotel"|trans }} *</label>
                    
                    <div class="controls">
                        <input type="text" class="input-xlarge" name="hoteltel" id="hoteltel" value="{{tel}}" />
                    </div>
                    
                </div>

                <div class="form-actions">
                    <input type="submit" class="btn btn-primary" name="DadesGuardaPa" value="Guardar" >
                    {% if alta != 1 %}
                    <a href="{{ path('HotelBundle_homepage') }}" class="btn">Cancelar</a>
                    {% endif %}
                </div>
              
            </fieldset>
        </form>
        
    </div>

{% endblock %}